<?php 
include "config.php";

function query($query){
	global $db_host, $db_user, $db_pass, $db_name;
	$connection=mysql_connect($db_host, $db_user, $db_pass);
	mysql_select_db($db_name, $connection);

	$res = mysql_query($query);
	
	if($res !== false){
		if(mysql_affected_rows() === 0){
			return $res;
		}else{
	 		return mysql_insert_id();
		}
		
	}else{
		echo $query;
		return false;
	}
		
	
}

function createArray($query){
	$result = array();
	$db_res = query($query);

	while($row = mysql_fetch_assoc($db_res)){
		array_push($result, $row);

	}
	
	return $result;
}

